<template>
  <div class="page">
    <div class="admin-item">
      <div class="switch-box vux-1px-b">
        <div class="left-text">发放员管理</div>
        <div class="switch-wrap" @click="openOrClose()">
          <span class="btn" :class="isEnable ? 'btn_on' : 'btn_off'"><!--btn_on 进行中样式  btn_off 已暂停样式-->  
              <i class="t_green">启用</i>
              <i class="t_grey">禁用</i>  
              <i class="btn_bg"></i>  
          </span>
        </div>
      </div>
      <div class="item-content">
        <div class="item-line">
          <span class="line-left">发放员名称</span>
          <span class="line-right">JH</span>
        </div>
        <div class="item-line">
          <span class="line-left">手机号码</span>
          <span class="line-right">12345678900</span>
        </div>
        <div class="item-line">
          <span class="line-left">添加日期</span>
          <span class="line-right">2018-08-10 16:00:06</span>
        </div>
      </div>
    </div>

    <div class="admin-item disabled">
      <div class="switch-box vux-1px-b">
        <span class="left-text">发放员管理</span>
        <button class="del-btn" @click="delAdmin">删除</button>
        <div class="switch-wrap" @click="openOrClose()">
          <span class="btn" :class="isEnable ? 'btn_on' : 'btn_off'"><!--btn_on 进行中样式  btn_off 已暂停样式-->  
              <i class="t_green">启用</i>
              <i class="t_grey">禁用</i>  
              <i class="btn_bg"></i>  
          </span>
        </div>
      </div>
      <div class="item-content">
        <div class="item-line">
          <span class="line-left">发放员名称</span>
          <span class="line-right">JH</span>
        </div>
        <div class="item-line">
          <span class="line-left">手机号码</span>
          <span class="line-right">12345678900</span>
        </div>
        <div class="item-line">
          <span class="line-left">添加日期</span>
          <span class="line-right">2018-08-10 16:00:06</span>
        </div>
      </div>
    </div>

    <div class="footer-box">
      <div class="add-btn" @click="toAddGrant()">添加发放员</div>
    </div>
    <MaskForm v-show="showMaskForm" :layerHeadTitle="layerHeadTitle" :layerBodyTip="layerBodyTip" @sureBtnEvent="sureBtnEvent" @closeMaskForm="closeMaskForm"></MaskForm>
  </div>
</template>

<script>
  import MaskForm from '@/components/MaskForm'
  export default {
    components:{
      MaskForm
    },
    data(){
      return{
        title: '发券授权',
        isEnable: false, //按钮是否开启
        layerHeadTitle: '删除发放员',
        layerBodyTip: '确认要删除此发放员吗？',
        showMaskForm: false,
      }
    },
    created(){
      this.$store.commit('setTitle',this.title);
      this.$store.commit('setShowCloseBtn',false)
    },
    methods: {
      openOrClose(){
        this.isEnable = this.isEnable ? false : true;
      },
      delAdmin(){
        this.showMaskForm=true
      },
      sureBtnEvent(){
      
      },
      closeMaskForm(){
        this.showMaskForm = false
      },
      toAddGrant(){ //添加发放员
        this.$router.push({path:'/addGrant'})
      }
    }
  }
</script>

<style scoped>
.footer-box{
  position: absolute;
  bottom: 0;
  height: 120px;
  width: 100%;
  background: #ffffff;
  box-shadow: 0 -1px 6px 0 rgba(0,0,0,0.12);
  text-align: center;
  padding: 16px 30px;
}
.add-btn{
  height: 88px;
  line-height: 88px;
  background: #1875ED;
  border-radius: 10px;
  text-align: center;
  font-size: 34px;
  color: #FFFFFF;
  letter-spacing: 1.1px;
}
.admin-item{
  height: 308px;
  background: #ffffff;
  margin-top: 20px;
  padding: 0 20px;
}
.disabled span{
  color: #ABABAB;
}
.item-content{
  padding-top: 15px;
}
.item-line{
  display: flex;
  justify-content: space-between;
  height: 70px;
  line-height: 70px;
}
.item-line span{
  font-size: 30px;
}
.line-left{
  color: #696969;
  letter-spacing: 1px;
}
.line-right{
  color: #262626;
}
.del-btn{
  width: 124px;
  height: 62px;
  border: 2px solid #F44A4A;
  border-radius: 100px;
  background: #ffffff;
  font-size: 26px;
  color: #F44A4A;
  letter-spacing: 1px;
  margin-right: 20px;
}
.switch-box {
  height: 80px;
  line-height: 80px;
  display: flex;
  align-items: center;
}
.left-text {
  font-size: 30px;
  color: #262626;
  letter-spacing: 0;
  flex: 1;
}
/*切换按钮--start*/
.switch-wrap{
  height: 80px;
  line-height: 80px;
  display: flex;
  align-items:center;
}
.switch-wrap i {
  font-style: normal;
}
/*暂停/启用 按钮*/
.switch-wrap .btn {
  display: block;
  width: 138px;
  height: 62px;
  border: 2px solid #e5e5e5;
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  background-color: #ffffff;
}
/*暂停/启用  文字*/
.btn .t_green,
.btn .t_grey {
  display: block;
  width: 50%;
  height: 62px;
  line-height: 62px;
  font-size: 24px;
  color: #707070;
  opacity: 0;
}
.btn .t_green {
  float: left;
}
.btn .t_grey {
  float: right;
}
/*暂停/启用  是否启用状态圆圈*/
.btn_bg {
  display: block;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  position: absolute;
  top: 0px;
  -webkit-transition: all 0.2s linear;
  -moz-transition: all 0.2s linear;
  -ms-transition: all 0.2s linear;
  -o-transition: all 0.2s linear;
  transition: all 0.2s linear;
  background-color: #ffffff;
  border: 1px solid #e5e5e5;
  box-shadow: 2px 2px 5px #c6c6c6;
}
/*不同状态下的相应样式*/
.switch-wrap .btn_on{ /*启动*/
  background-color: #38d39f;
}
/*暂停/启用  文字*/
.btn_on .t_green { /*启用*/
  color: #ffffff;
  opacity: 1;
  text-align: right;
}
.btn_off .t_grey { /*禁用*/
  opacity: 1;
  text-align: center;
}
/*暂停/启用  是否启用状态圆圈*/
.btn_on .btn_bg {
  left: 78px;
}
.btn_off .btn_bg {
  left: 0px;
}
</style>
